package server

import (
	"data_service/models"
)

// ChatService 提供消息相关业务逻辑
// 供 handler 层调用，解耦 handler 与 models
// 只负责业务流程，不直接操作数据库

type ChatService struct{}

func NewChatService() *ChatService {
	return &ChatService{}
}

// SendMessage 发送消息
func (s *ChatService) SendMessage(msg *models.Message) error {
	return models.CreateMessage(msg)
}

// GetRoomMessages 获取房间消息历史
func (s *ChatService) GetRoomMessages(roomID uint, page int, pageSize int) ([]models.Message, error) {
	return models.GetMessagesByRoom(roomID, page, pageSize)
}
